package com.Pan.controller;


import com.Pan.service.RetryService;
import com.Pan.util.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jialipan
 * @date 2021-06-28 09:44:19
 */

@RestController
@RequestMapping("/retry/")
public class EnterpriseController {

    @Autowired
    private RetryService retryService;

    /**
     * 标准环境图像识别接口  新老流程自动切换
     *
     * @return
     */
    @RequestMapping(value = "ImageStandard", method = RequestMethod.GET)
    public ResponseData getImageStandardRetry(@RequestParam(value = "time") long time, @RequestParam(value = "num") Integer num, @RequestParam(value = "overstock") Integer overstock) {
        try {
            return retryService.getImageStandardRetry(time, num, overstock);
        } catch (Exception e) {
            return ResponseData.failure();
        }
    }

    /**
     * 旺旺腾讯云环境  图像识别接口
     *
     * @return String
     */
    @RequestMapping(value = "tencentIdentification", method = RequestMethod.GET)
    public ResponseData getTencentIdentificationRetry(@RequestParam(value = "time") long time, @RequestParam(value = "num") Integer num) {
        try {
            return retryService.getIdentificationStandardRetry(time, num);
        } catch (Exception e) {
            return ResponseData.failure();
        }
    }

    /**
     * 统一腾讯云环境  图像识别接口
     *
     * @return
     */
    @RequestMapping(value = "tencentTongYiIdentification", method = RequestMethod.GET)
    public ResponseData getIdentificationStandardRetry(@RequestParam(value = "time") long time, @RequestParam(value = "num") Integer num) {
        try {
            return retryService.getIdentificationTongYiStandardRetry(time, num);
        } catch (Exception e) {
            return ResponseData.failure();
        }
    }

    /**
     * 腾讯云环境  费列罗手动回调接口
     *
     * @return
     */
    @RequestMapping(value = "ferreroCallBack", method = RequestMethod.GET)
    public ResponseData getFerreroCallback(@RequestParam(value = "time") long time) {
        try {
            return retryService.getFerreroCallback(time);
        } catch (Exception e) {
            return ResponseData.failure();
        }
    }

    /**
     * 旺旺腾讯云环境  新流程重跑  可以弃用  完全使用图像识别接口重跑
     *
     * @return String
     */
    @RequestMapping(value = "newtencent", method = RequestMethod.GET)
    public ResponseData getTencentRetry(@RequestParam(value = "time") long time, @RequestParam(value = "retry") Boolean retry) {
        try {
            return retryService.getTencentRetry(time, retry);
        } catch (Exception e) {
            return ResponseData.failure();
        }
    }

    /**
     * epsilon环境  api重跑
     *
     * @return String
     */
    @RequestMapping(value = "newEpsilon", method = RequestMethod.GET)
    public ResponseData getEpsilonRetry(@RequestParam(value = "time") long time, @RequestParam(value = "retry") Boolean retry) {
        try {
            return retryService.getEpsilonRetry(time, retry);
        } catch (Exception e) {
            return ResponseData.failure();
        }
    }


    /**
     * 标准环境新流程  可以弃用  完全使用图像识别接口重跑
     *
     * @return
     */
    @RequestMapping(value = "newstandard", method = RequestMethod.GET)
    public ResponseData getNewStandardRetry(@RequestParam(value = "time") long time, @RequestParam(value = "retry") Boolean retry) {
        try {
            return retryService.getNewStandardRetry(time, retry);
        } catch (Exception e) {
            return ResponseData.failure();
        }
    }

    /**
     * DCS 系统拜访重新提交
     *
     * @return
     */
    @RequestMapping(value = "dcs", method = RequestMethod.GET)
    public ResponseData getDcsRetry(@RequestParam(value = "time") long time) {
        try {
            return retryService.getDcsRetry(time);
        } catch (Exception e) {
            return ResponseData.failure();
        }
    }

    @RequestMapping(value = "uatIdentification", method = RequestMethod.GET)
    public ResponseData retryUatResponse(@RequestParam(value = "time") long time, @RequestParam(value = "num") long num) {

        try {
            return retryService.uatIdentification(time, num);
        } catch (Exception e) {
            return ResponseData.failure();
        }
    }

}
